package com.nju.bean.net;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.net.ServerSocket;
import java.net.Socket;

import com.nju.bean.string.Configration;


public class NetManager {
ServerSocket serverSocket;
	
	public NetManager() throws NumberFormatException, IOException{
		ServerSocket();
	}
	
	private ServerSocket ServerSocket() throws NumberFormatException, IOException{
		serverSocket = new ServerSocket(Integer.parseInt((Configration.getIniKey("ServerPort"))));
		return serverSocket;
	}
	
	public Socket getSocket() throws IOException{
		return serverSocket.accept();
	}
	
	public String getString(Socket socket) throws ClassNotFoundException, IOException{
		ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
		String str = (String)ois.readObject();
		return str;
	}
	public void sendString(Socket socket,String string){
		
	}
}
